package com.ky.serialportpackage;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.ky.serialport.service.SerialPortService;

public class TestActivity extends AppCompatActivity {

    private Intent intentSerialPort;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test2);
        //串口读取服务
        intentSerialPort = new Intent();
        intentSerialPort.setClass(TestActivity.this, SerialPortService.class);
        startService(intentSerialPort);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (intentSerialPort != null) {
            stopService(intentSerialPort);
            intentSerialPort = null;
        }
    }
}
